package cn.com.yxw.webapp.common;

import org.springframework.web.context.ServletContextAware;

import javax.servlet.ServletContext;

/**
 * Created by Administrator on 2015/6/7.
 */
public class ResourcePathExposer implements ServletContextAware{
    private ServletContext servletContext;
    private String resourceRoot;

    public void init() {
        //瀹為檯搴旂敤涓紝鍙互鍦ㄥ閮ㄥ睘鎬ф枃浠舵垨鏁版嵁搴撲繚瀛樺簲鐢ㄧ殑鍙戝竷鐗堟湰鍙峰啀姝よ幏鍙�
        String version = "1.2.1";
        //璧勬簮閫昏緫璺緞甯︿笂搴旂敤鐨勫彂甯冪増鏈彿
        resourceRoot = "/resources-" + version;
        //璧勬簮閫昏緫璺緞鏆撮湶鍒癝ervletContext鐨勫睘鎬у垪琛ㄤ腑
        getservletcontext().setAttribute("resourceRoot", getservletcontext().getContextPath()+resourceRoot);
    }
    
   

    public String getResourceRoot(){
        return resourceRoot;
    }

    public ServletContext getservletcontext() {
        return servletContext;
    }



	public void setServletContext(ServletContext servletContext) {
		this.servletContext = servletContext;
		
	}
}
